package main

import (
	"fmt"
	"my_music_server/common"
	"my_music_server/config"
	"my_music_server/dao"
	"my_music_server/routers"
)

func init()  {
	//加载server配置
	err:=config.InitServerConfig()
	if err!=nil{
		panic(common.ERROR_JSON_PARSE)
	}
	err = dao.InitMySQL()
	if err != nil {
		panic(common.DB_CONN_FAIL)
	}
}

// @title MyMusic音乐播放器后端
// @version 1.0
// @description MyMusic音乐播放器后端
// @termsOfService http://swagger.io/terms/

// @contact.name ADUN
// @contact.url http://www.swagger.io/support
// @contact.email support@swagger.io

// @license.name MIT

// @host 127.0.0.1:9000
func main() {
	defer dao.Close()
	//模型绑定【可选】

	//映射路由
	router := routers.SetupRouters()
	//router.Run(":"+fmt.Sprintf("%d",config.ServerAllConfig.Port))
	router.Run(":"+fmt.Sprintf("%d",config.AppicationConfig.Server.Port))
}
